跳到主要内容

SetAlignHorizontal

Sets the horizontal alignment of the text in the current cell range.

Syntax

expression.SetAlignHorizontal(sAlignment);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sAlignmentRequired'left''right''center'

Returns

boolean

Example

This example sets the horizontal alignment of the text in the cell range.

var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A2").SetValue("2");
var oRange = oWorksheet.GetRange("A1:D5");
oRange.SetAlignHorizontal("center");